#pragma once

#include <list>
#include <map>
#include "pnapi/pnapi.h"

struct Context
{
    enum State {
        OUT_OF_FUNCTION,
        IN_FUNCTION,
        IN_BLOCK
    };
    pnapi::PetriNet net_;
    State state_;
    std::string cur_func_id_;
    pnapi::Place* cur_func_entry_;
    std::map<int, pnapi::Place*> cur_blocks_;
    int cur_block_id_; //  the number inside a function 1..n

    std::list<std::pair<int, int> > block_links_;

public:
    void Reset()
    {
        cur_func_id_ = "";
        cur_func_entry_ = 0;
        cur_blocks_.clear();
        cur_block_id_ = 0;
        block_links_.clear();
    }
};

